﻿import com.dmotiko.mirador.*
import com.dmotiko.general.*

class MiradorServiciosEventosNavBar
extends BaseClip {
	private var mcEventos:MovieClip;
	private var mcServicios:MovieClip;
	private var mcPorQue:MovieClip;
	private var mcClientes:MovieClip;
	private var lastBtn:MovieClip;
		
	private function initClip():Void {
		super.initClip();
		var root:MiradorServiciosEventosNavBar = this;
		
		mcEventos.value = MiradorOrganizacionEventos.MAIN;
		mcServicios.value = MiradorOrganizacionEventos.AMBIENTACION;
		mcPorQue.value = MiradorOrganizacionEventos.ENTRETENIMIENTOS;
		mcClientes.value = MiradorOrganizacionEventos.MUSICA;
				
		function btnRelease():Void {
			root.childChanged(this);
		}
		
		function btnOut():Void {
			if (this.bActive) return;
			this.gotoAndStop(1);
		}
		
		function btnOver():Void	{
			this.gotoAndStop(2);
		}
		
		mcEventos.onRollOver = 
		mcServicios.onRollOver =
		mcPorQue.onRollOver =
		mcClientes.onRollOver = btnOver;
		
		mcEventos.onRollOut = 
		mcServicios.onRollOut =
		mcPorQue.onRollOut =
		mcClientes.onRollOut = btnOut;
		
		mcEventos.onRelease = 
		mcServicios.onRelease =
		mcPorQue.onRelease =
		mcClientes.onRelease = btnRelease;
	}
		
	private function childChanged( child ) {
		lastBtn.bActive = false;
		lastBtn.onRollOut();
		child.bActive = true;
		lastBtn = child;
		this.dispatchEvent( { type: BaseClipEvent.CHANGED, target: this, data: child.value } );
	}
	
}